package com.shop.common.enums;

public enum QuestionTypeEnum {
    VOICE(5, "语音"),
    TEXT(4, "简答"),
    MULTIPLE(3, "多选"),
    JUDGEMENT(2, "判断"),
    CHOICE(1, "单选");

    private final int code;
    private final String msg;

    QuestionTypeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    /**
     * 根据编码获取Msg
     *
     * @author fzr
     * @param code 类型
     * @return String
     */
    public static String getMsgByCode(Integer code){
        for(QuestionTypeEnum enumItem: QuestionTypeEnum.values()) {
            if (enumItem.getCode() == code) {
                return enumItem.getMsg();
            }
        }
        return null;
    }
}
